#pragma once

class ConsoleFrame
{
public:
	enum SplitOrder
	{
		None,
		Horizontal,
		Vertical,
	};

	ConsoleFrame(unsigned int width, unsigned int height);
	~ConsoleFrame(void);

	void AddFrame(shared_ptr<ConsoleFrame> frame, SplitOrder order);
	void SetSize(unsigned int left, unsigned int top, unsigned int width, unsigned int height);
	HRESULT SetTextBuffer(char * text);
	HRESULT ShowContent(void);

protected:
	static void SetCursor(short x, short y);
	void PrintTextBuffer(void) const;
	void CalculateSizeForSiblings(unsigned int newleft, unsigned int newtop, unsigned int newwidth, unsigned int newheight);
	typedef vector<shared_ptr<ConsoleFrame>> FrameList;
	FrameList _List;
	SplitOrder _Order;
	unsigned int _Width;
	unsigned int _Height;
	unsigned int _Left;
	unsigned int _Top;
	char _TextBuffer[10000];
};

